package com.bigdata.booklibraryseatapi.controller;

import com.bigdata.booklibraryseatapi.common.pojo.PageResult;
import com.bigdata.booklibraryseatapi.service.IBookTimeQuantumService;
import com.bigdata.booklibraryseatapi.vo.req.*;
import com.bigdata.booklibraryseatapi.vo.resp.AreaListRespVO;
import com.bigdata.booklibraryseatapi.vo.resp.PageAreaRespVO;
import com.bigdata.booklibraryseatapi.vo.resp.PageBookTimeQuantumRespVO;
import com.bigdata.booklibraryseatapi.vo.resp.TimeQuantumListRespVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 预约时间段 前端控制器
 * </p>
 *
 * @author book
 * @since 2023-12-13
 */
@RestController
@RequestMapping("/api")
@Api(value = "BookTimeQuantumController",tags = {"预约时间段接口"})
public class BookTimeQuantumController {

    @Resource
    private IBookTimeQuantumService iBookTimeQuantumService;

    @PostMapping("/admin/time/add")
    @ApiOperation(value = "时间段添加接口")
    public void addTimeQuantum(@RequestBody @Valid AddTimeQuantumReqVO vo) {
        iBookTimeQuantumService.addTimeQuantum(vo);
    }


    @PostMapping("/admin/time/edit")
    @ApiOperation(value = "时间段修改接口")
    public void editTimeQuantum(@RequestBody @Valid EditTimeQuantumReqVO vo) {
        iBookTimeQuantumService.editTimeQuantum(vo);
    }

    @PostMapping("/admin/time/list")
    @ApiOperation(value = "时间段列表接口")
    public List<TimeQuantumListRespVO> getTimeQuantumList() {
        return iBookTimeQuantumService.getTimeQuantumList();
    }

    @PostMapping("/admin/time")
    @ApiOperation(value = "时间段分页接口")
    public PageResult<PageBookTimeQuantumRespVO> pageArea(@RequestBody @Valid PageBookTimeQuantumReqVO vo) {
        return iBookTimeQuantumService.pageBookTimQuantum(vo);
    }
}
